<?php
if(!defined('BZ_XTBLOG') || !defined('BZ_WJSCUZ')) {
	exit('Access Denied');
}
$lx=$_GET['lx'];
$act=$_GET['act'];
$wzxx_title ='帐单明细-'.$wzxx_title.'';
$wzxx_gj    ='帐单明细-'.$wzxx_gj.'';
$wzxx_ms    ='帐单明细-'.$wzxx_ms.'';
if(!$user_uid){
		 $pdid='1';
}elseif($act == 'cz'){
	  $renminbi=Bingz_config('renminbi_config_alipaydualfun_sz');
	  
	  $alipay=Bingz_config('renminbi_config_zh_alipay_sz');
	  $alipay_name=Bingz_config('renminbi_config_zh_alipay_name');
	  $alipay_zh=Bingz_config('renminbi_config_zh_alipay_zh');
	  
	  $zgyh=Bingz_config('renminbi_config_zh_zgyh_sz');
	  $zgyh_name=Bingz_config('renminbi_config_zh_zgyh_name');
	  $zgyh_zh=Bingz_config('renminbi_config_zh_zgyh_zh');
	  
	  $nyyh=Bingz_config('renminbi_config_zh_nyyh_sz');
	  $nyyh_name=Bingz_config('renminbi_config_zh_nyyh_name');
	  $nyyh_zh=Bingz_config('renminbi_config_zh_nyyh_zh');

	  $pdid='2';
}elseif($act == 'czts'){
	  if($_GET['lx'] == '1'){
	     $czts='提交的金额有误！';
	  }elseif($_GET['lx'] == '2'){
	     $czts='充值成功！';
	  }elseif($_GET['lx'] == '3'){
	     $czts='提交错误！';
    }	  	 
	  $pdid='3';
}elseif($act == 'dhje'){
	  $renminbi=$_GET['renminbi'];
	  $management_name=Bingz_management_name($renminbi);
	  $management    =Bingz_config('user_config_'.$renminbi.'_sz');
	  $management_bl =Bingz_config('user_config_'.$renminbi.'_bla');
	  $management_blh=Bingz_config('user_config_'.$renminbi.'_blb');
    $pdid='4';
}elseif($act == 'dhjeok'){
	  $renminbi=$_GET['renminbi'];
	  $management=$_GET['management'];
	  $name=$_POST['name'];
	  if($renminbi == 'renminbi'){
	     $management_name=Bingz_management_name($management);
	     $management_bl =Bingz_config('user_config_'.$management.'_bla');
	     $management_blh=Bingz_config('user_config_'.$management.'_blb');
	     $namemm=sprintf("%.0f",($_POST['name']/$management_blh));
	     $management_b=$management_blh;
	  }else{
	     $management_name=Bingz_management_name($renminbi);
	     $management_bl =Bingz_config('user_config_'.$renminbi.'_bla');
	     $management_blh=Bingz_config('user_config_'.$renminbi.'_blb');
	     $namemm=$_POST['name']*$management_bl;
	     $management_b=$management_bl;
	  }
	 if($name < 1){
   	  $tjts='提交金额有误！';
	 }elseif(Bingz_renminbi_pass_yz($user_uid,$_POST['passmb'],$_POST['pass']) < '1'){
   	  $tjts='支付密码或密保错误！';
	 }elseif(!Bingz_management_pd($user_uid,$management,$name)){
   	  $tjts='金额不够对换！';
	 }elseif($management_b < '1'){
   	  $tjts='对换功能关闭！';
   }elseif(Bingz_management($user_uid,$management,'-'.$name,'对换'.$management_name.'',$_POST['passmb'],$_POST['pass']) > '0'){
   	       Bingz_management($user_uid,$renminbi,'+'.$namemm,'成功对换'.$management_name.'',$_POST['passmb'],$_POST['pass']);
   	  $tjts='对换成功！';
   }else{
   	  $tjts='对换失败！请确认提交正确！';
   }
    $pdid='5';
}elseif($act == 'tx'){
	  $renminbi=Bingz_config('user_config_tixisz');
    $sql_bbs  =$db->query('user_renminbi_zh'," `uid` ='$user_uid' and `type` = '1' ORDER BY `id` DESC ",'');
    while($row_b=mysql_fetch_array($sql_bbs)){
         $renmi[]= array('id' => $row_b['id'],'name_lx' => $row_b['name_lx'],'name' => $row_b['name'],'zh' => $row_b['zh'],'name_name' => $row_b['name_name']);
    }
	  $pdid='6';
}elseif($act == 'txok'){
	  $renminbi=$_POST['renminbi'];
	  $name=$_POST['name'];
	 if($renminbi < 0.9){
   	  $tjts='提交金额有误！必须大于1！';
	 }elseif(!$name){
   	  $tjts='提现账号没有！';
	 }elseif(Bingz_renminbi_pass_yz($user_uid,$_POST['passmb'],$_POST['pass']) < '1'){
   	  $tjts='支付密码或密保错误！';
	 }elseif(!Bingz_management_pd($user_uid,'renminbi',$renminbi)){
   	  $tjts='金额不够提现！';
   }else if(Bingz_management($user_uid,'renminbi','-'.$renminbi,'提现人民币',$_POST['passmb'],$_POST['pass'],'3','','2','等待审核',$name) > '0'){
   	  $tjts='提现成功！';
   }else{
   	  $tjts='提现失败！请确认提交正确！';
   }
	 $pdid='7';
}elseif($act == 'bd'){
    $sql_bbs  =$db->query('user_renminbi_zh'," `uid` ='$user_uid' ORDER BY `id` DESC ",'');
    while($row_b=mysql_fetch_array($sql_bbs)){
    	   if($row_b['type'] == '1'){$zt='绑定';}else{$zt='未绑定';}
         $renmi[]= array('id' => $row_b['id'],'name_lx' => $row_b['name_lx'],'name' => $row_b['name'],'zh' => $row_b['zh'],'zt' => $zt);
    }
	  $utss=$db->num_rows('user_renminbi_zh',"`uid` = '$user_uid' ",'id');
	  $pdid='8';
}elseif($act == 'bdok'){
	  $renminbi=$_POST['renminbi'];
	  $name=$_POST['name'];
	  $lx=$_POST['lx'];
	 if(!$renminbi or !$name or !$lx){
   	  $tjts='提交有误！';
   }else if($db->insert('user_renminbi_zh',array('id' => 'NULL','uid' => $user_uid,'type' => 0,'name' => $name,'name_lx' => $lx,'name_name' => '','zh' => $renminbi ))){
   	  $tjts='创建成功！';
   }else{
   	  $tjts='创建失败！';
   }
	 $pdid='9';
}elseif($act == 'usertx'){
if($_GET[uid]){
           $num_count=$db->num_rows('user_renminbi',"`type` ='3' and `uid` = '$_GET[uid]' ",'id');
           $list_num ="10";
           $num_start=page_num($list_num,$num_count);
           $sql_bbs  =$db->query('user_renminbi',"`type` ='3' and `uid` = '$_GET[uid]' ORDER BY `id` DESC LIMIT ".$num_start." , ".$list_num." ",'');
}elseif($_POST[uid]){
           $num_count=$db->num_rows('user_renminbi',"`type` ='3' and `uid` = '$_POST[uid]' ",'id');
           $list_num ="10";
           $num_start=page_num($list_num,$num_count);
           $sql_bbs  =$db->query('user_renminbi',"`type` ='3' and `uid` = '$_POST[uid]' ORDER BY `id` DESC LIMIT ".$num_start." , ".$list_num." ",'');
}else{
           $num_count=$db->num_rows('user_renminbi',"`type` ='3' ",'id');
           $list_num ="10";
           $num_start=page_num($list_num,$num_count);
           $sql_bbs  =$db->query('user_renminbi',"`type` ='3' ORDER BY `id` DESC LIMIT ".$num_start." , ".$list_num." ",'');
}
           while($row_c=mysql_fetch_array($sql_bbs)){
           	     $name=$user_class->user_name($row_c[uid]);
           	     $sj=Bingz_time($row_c[time_a]);
           	     $renmin=explode("-",$row_c[renminbi_cz]);
                 $renminbi[]= array('sj' => $sj,'renminbi' => $renmin[1],'name' => $name,'uid' => $row_c['uid'],'zt' => $row_c['renminbi_ztname']);
           }
           $page=page_link($list_num,$num_count);
	 $pdid='10';
}else{
if($_POST[name] && $db->get_one('user_renminbi'," `uid` ='$user_uid' and `name` = '$_POST[name]' ",'')){
   $num_count=$db->num_rows('user_renminbi'," `uid` ='$user_uid' and `name` = '$_POST[name]' ",'id');
   $list_num ="10";
   $num_start=page_num($list_num,$num_count);
   $sql_bbs  =$db->query('user_renminbi'," `uid` ='$user_uid' and `name` = '$_POST[name]' ORDER BY `id` DESC LIMIT ".$num_start." , ".$list_num." ",'');
}else{
   $num_count=$db->num_rows('user_renminbi'," `uid` ='$user_uid'",'id');
   $list_num ="10";
   $num_start=page_num($list_num,$num_count);
   $sql_bbs  =$db->query('user_renminbi'," `uid` ='$user_uid' ORDER BY `id` DESC LIMIT ".$num_start." , ".$list_num." ",'');
}
   while($row_b=mysql_fetch_array($sql_bbs)){
   	     $tsj=Bingz_time_f($row_b['time_a']);
         $renminbi[]= array('sj' => $tsj,'ztname' => $row_b['renminbi_ztname'],'name' => $row_b['name'],'renminbi_cz' => $row_b['renminbi_cz'],'renminbi_yl' => $row_b['renminbi_yl'],'content' => $row_b['content'],'renminbi' => $row_b['renminbi']);
   }
   $page=page_link($list_num,$num_count);
}
@include template('head');
@include template('user/user_renminbi');
@include template('foot');
?>